package test
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	
	import flexunit.framework.TestCase;
	import flexunit.framework.TestSuite;
	
	import model.xpdl2.Package;
	
	import util.ConfigUtil;
	
	public class ProcessTestCase extends TestCase
	{
	
		public function ProcessTestCase(methodName:String=null)
		{
			//TODO: implement function
			super(methodName);
		}
		
		public function testProcessLoader(){}
		
		public function testProcessSaver(){}
		
		  /** 
           * 静态方法，返回这个TestCase包含的TestSuite 
           * author:sunkai 
           * date:2009-04-01 
           */  
          public static function Suite():TestSuite{  
              var suite:TestSuite = new TestSuite();  
                
             /*  suite.addTest(new ProcessTestCase("testAdd"));  
              suite.addTest(new ProcessTestCase("testSubtract"));   */
               suite.addTest(new ProcessTestCase("testXMLLoader"));  
                
              return suite;  
                
          }  
            
          /** 
           * TestCast的测试方法，测试业务类的加法逻辑 
           * author:sunkai 
           * date:2009-04-01 
           */  
           public function testAdd():void{  
              var result:Number = 0;  
                
              result = 1+2;             
              assertTrue("和为 3",result == 3);  
                
              result = 2+2;  
              assertEquals("和为 4",4,result);  
           }  
             
           /** 
           * TestCast的测试方法，测试业务类的减法逻辑 
           * author:sunkai 
           * date:2009-04-01 
           */  
           public function testSubtract():void{  
              var result:Number = 0;  
              result = 2-1;  
              assertTrue("结果为 1",result == 1);  
                
              assertTrue("结果为 0",0,(2-2));  
                
           }  
           
          public function testXMLLoader():void{
          	  var c:ConfigUtil=new ConfigUtil();
          	  trace(c.getProcessURL());
			/*   var loader:URLLoader=new URLLoader();
			  loader.dataFormat=URLLoaderDataFormat.TEXT;
			  loader.addEventListener(Event.COMPLETE, handleXMLLoaderComplete);
			  loader.load(new URLRequest("/test/test.xpdl2")); */
          }
          
          public function handleXMLLoaderComplete(event:Event):void{
          	 
          	 var xml:XML=new XML(event.target.data);
          	 var pack:Package=new Package();
          	 pack.initPackage(xml);
          	 
          }
           
           
           
           
	}
}